<?php
if(empty($_POST)) exit;

include 'config.php';
include 'config/koneksi.php';

// declare post fields
$post_username = $_POST[username];
$post_password = $_POST[password];

$login = mysql_query("SELECT * FROM users WHERE username COLLATE Latin1_General_CS= '$post_username' AND password COLLATE Latin1_General_CS= '$post_password'");

$ketemu=mysql_num_rows($login);
$r=mysql_fetch_array($login);

// Apabila username dan password ditemukan
if ($ketemu > 0){
mysql_query("UPDATE menu SET aktif = '0' WHERE judul = 'Logout'");
mysql_query("UPDATE menu SET aktif = '1' WHERE judul = 'Registrasi'");
mysql_query("UPDATE menu SET aktif = '1' WHERE judul = 'Login'");
mysql_query("UPDATE menu SET aktif = '0' WHERE judul = 'Profil User'");
mysql_query("UPDATE menu SET aktif = '0' WHERE judul = 'Halaman Post'");
$_SESSION[username] = $post_username;
exit('OK');
include "media.php?module=profiluser";
}
else
{
echo '<div id="error_notification">The submitted login info is incorrect.</div>';
}
?>